﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using LibMinecraft.Server;
using LibMinecraft.Model.Packets;
using LibMinecraft.Model;

namespace PartyCraftServer.Commands
{
    public class ListCommand : Command
    {
        public override bool RequiresOp
        {
            get { return false; }
        }

        public override string DefaultCommand
        {
            get { return "list"; }
        }

        public override string Documentation
        {
            get { return "Lists all players currently connected to this server"; }
        }

        public override void ExecuteCommand(RemoteClient client, params string[] parameters)
        {
            if (PartyCraft.Server.ConnectedClients.Count == 0)
                return;
            string value = "";
            foreach (RemoteClient c in PartyCraft.Server.GetLoggedInClients())
                value += ", " + c.PlayerEntity.Name;
            value = value.Substring(2);
            client.SendChat(ChatColor.Blue + value);
        }
    }
}
